@foreach (session('flash_notification', collect())->toArray() as $message)
    @if ($message['overlay'])
        <div id="flash-overlay-modal" class="modal fade {{ 'flash-modal' or '' }}">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title">{{ $message['title'] }}</h5>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                    <div class="modal-body">
                        <p>{!! $message['message'] !!}</p>
                    </div>
                </div>
            </div>
        </div>
    @else
        <div class="alert
                    alert-{{ $message['level'] }}
        {{ $message['important'] ? 'alert-important' : '' }}"
             role="alert"
        >
            @if ($message['important'])
                <button type="button"
                        class="close"
                        data-dismiss="alert"
                        aria-hidden="true"
                >&times;</button>
            @endif

            {!! $message['message'] !!}
        </div>
    @endif
@endforeach
<script>
    require(['jquery','bootstrap'], function ($) {
        $('#flash-overlay-modal').modal('show');
        setTimeout(function () {
            $('#flash-overlay-modal').modal('hide');
        }, 3000);
    })
</script>
{{ session()->forget('flash_notification') }}
